<html>

<head>
	<title>Your Website Title</title>
	<!-- You can use Open Graph tags to customize link previews.
Learn more: https://developers.facebook.com/docs/sharing/webmasters -->
	<meta property="og:url" content="https://www.your-domain.com/your-page.html" />
	<meta property="og:type" content="website" />
	<meta property="og:title" content="Your Website Title" />
	<meta property="og:description" content="Your description" />
	<meta property="og:image" content="https://www.your-domain.com/path/image.jpg" />
</head>

<body>

	<!-- Load Facebook SDK for JavaScript -->
	<button id="fb-btn" style="height: 100px;display: none;">分享</button>
	<script>(function (d, s, id) {
			var js, fjs = d.getElementsByTagName(s)[0];
			if (d.getElementById(id)) return;
			js = d.createElement(s); js.id = id;
			js.src = "https://connect.facebook.net/en_US/sdk.js";
			fjs.parentNode.insertBefore(js, fjs);
		}(document, 'script', 'facebook-jssdk'));</script>

	<!-- Your share button code -->
	<!-- Your share button code -->
	<!-- <div class="fb-share-button" data-href="https://www.souhu.com" data-layout="button_count" id="fb-btn">
	</div> -->

	<script>
		var shareToFbBtn = document.getElementById('fb-btn');
		// document.getElementById('fb-btn').click();
		var str = location.search;
		str = str.substring(1, str.length);
		// 以&分隔字符串，获得类似name=xiaoli这样的元素数组
		var arr = str.split("&");
		var obj = new Object();
		var url
		
		// 将每一个数组元素以=分隔并赋给obj对象
		for (var i = 0; i < arr.length; i++) {
			var tmp_arr = arr[i].split("=");
			console.log(tmp_arr[1])
			url=tmp_arr[1]
			obj[decodeURIComponent(tmp_arr[0])] = decodeURIComponent(tmp_arr[1]);
		}

		shareToFbBtn.onclick = function () {
			FB.init({
				appId: '986235162147796', //你的应用id,需要facebook开发者账号创建
				status: true,
				xfbml: true,
				version: 'v7.0'  //sdk版本
			});
			FB.ui({
				method: 'share',
				href: url //这里换成你的网址
			}, function (response) {
				//分享回调
			})
		}
		setTimeout(() => {
			document.getElementById('fb-btn').click();
		}, 1000)
	</script>
</body>

</html>